package com.rd.student.ruanjian.class1.duhang.NewNew0803;

import java.util.ArrayList;

public class Test {
    public static void main(String[] args) {
        ArrayList<D> list = new ArrayList();

        int[] arr = {15, 50, 25, 18};

        for (int i = 0; i < arr.length; i++) {
            list.add(new D(arr[i]));
        }

        for (int i = 0; i < list.size() - 1; i++) {
            for (int j = 0; j < list.size() - 1; j++) {
                if (list.get(i).getAge() > list.get(j).getAge()) {
                    int tmp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = tmp;
                }
            }
        }
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }

        System.out.println("---------------------------");

        for (int j = 0; j < arr.length; j++) {
            for (int k = j + 1; k < arr.length - j; k++) {
                int min = arr[j];
                if (arr[k] < min) {
                    int tmp = arr[k];
                    arr[k] = min;
                    arr[j] = tmp;
                }
            }
        }
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
    }
}
